﻿<Window x:Class="FluidKit.Showcase.ItemSkimmingPanel.Window1"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:ItemSkimmingPanel="clr-namespace:FluidKit.Showcase.ItemSkimmingPanel"
        xmlns:Controls="clr-namespace:FluidKit.Controls;assembly=FluidKit"
        Title="ItemSkimmingPanel - FluidKit"
        Height="500"
        Width="500"
    >
  <Window.Resources>
    <ItemSkimmingPanel:StringCollection x:Name="StringCollection"
                            x:Key="StringCollection"/>
    <DataTemplate x:Key="StringTemplate">
      <Border BorderThickness="2,2,2,2"
              BorderBrush="Black"
              CornerRadius="8"
              Background="White">
        <Image Source="{Binding}"
               VerticalAlignment="Center"
               HorizontalAlignment="Center"
               Width="100"
               Height="100"/>
      </Border>
    </DataTemplate>

    <ControlTemplate x:Key="VisualHostPanelTemplate">
      <Border BorderBrush="LightGray"
              BorderThickness="1,5,1,5"
              CornerRadius="3,3,3,3">
        <StackPanel Orientation="Horizontal"
                    x:Name="PART_ContextPanel"/>
      </Border>
    </ControlTemplate>

    <ControlTemplate x:Key="VisualTemplate">
      <Border x:Name="Border"
              BorderBrush="LightGray"
              BorderThickness="1"
              CornerRadius="3"
              Width="32"
              Height="32"
              Background="{TemplateBinding Background}"
              Margin="1,2,1,2"/>
      <ControlTemplate.Triggers>
        <Trigger Property="IsFocused"
                 Value="True">
          <Setter Property="BorderBrush"
                  Value="Gray"
                  TargetName="Border"/>
          <Setter Property="BorderThickness"
                  Value="1,3,1,3"
                  TargetName="Border"/>
          <Setter Property="Width"
                  Value="48"
                  TargetName="Border"/>
          <Setter Property="Height"
                  Value="48"
                  TargetName="Border"/>

        </Trigger>
      </ControlTemplate.Triggers>
    </ControlTemplate>

    <ItemsPanelTemplate x:Key="ItemPanelTemplate">
      <Controls:ItemSkimmingPanel IsItemsHost="True"
                                             Margin="0,60,0,0"
                                             ContextContainerTemplate="{StaticResource VisualHostPanelTemplate}"
                                             ContextItemTemplate="{StaticResource VisualTemplate}"/>
    </ItemsPanelTemplate>

  </Window.Resources>
  <DockPanel>
    <WrapPanel ItemWidth="100"
               ItemHeight="200">
      <ItemsControl ItemsSource="{StaticResource StringCollection}"
                    ItemTemplate="{StaticResource StringTemplate}"
                    ItemsPanel="{StaticResource ItemPanelTemplate}"
                    Margin="10"/>
      <ItemsControl ItemsSource="{StaticResource StringCollection}"
                    ItemTemplate="{StaticResource StringTemplate}"
                    ItemsPanel="{StaticResource ItemPanelTemplate}"
                    Margin="10"/>
    </WrapPanel>
  </DockPanel>
</Window>
